import time

from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "dbshopST011_添加商品"

# 打开后台网址
firefox = openBrowser(urlAdmin)
# 登陆
DBshopLoginAdmin(firefox)
# 进入二级菜单
DBshopEnterMenu2(firefox, '商品管理', '管理商品')
firefox.find_element_by_partial_link_text('添加商品').click()
firefox.find_element_by_id('goods_name').send_keys('苹果XR')
firefox.find_element_by_id('goods_shop_price').send_keys('7999')
firefox.find_element_by_xpath('(//select[@id="goods_type"])/option[3]').click()
firefox.find_element_by_xpath('//button[@type="submit"]').click()
#断言
try:
    firefox.find_element_by_xpath('//td[contains(.," 苹果XR")]')
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()
